import request from '@/config/axios'

// 资讯浏览记录 VO
export interface HistoryVO {
  id: number // ID
  articleId: number // 内容id
  mid: number // 所属用户
}

// 资讯浏览记录 API
export const HistoryApi = {
  // 查询资讯浏览记录分页
  getHistoryPage: async (params: any) => {
    return await request.get({ url: `/cms/history/page`, params })
  },

  // 查询资讯浏览记录详情
  getHistory: async (id: number) => {
    return await request.get({ url: `/cms/history/get?id=` + id })
  },

  // 新增资讯浏览记录
  createHistory: async (data: HistoryVO) => {
    return await request.post({ url: `/cms/history/create`, data })
  },

  // 修改资讯浏览记录
  updateHistory: async (data: HistoryVO) => {
    return await request.put({ url: `/cms/history/update`, data })
  },

  // 删除资讯浏览记录
  deleteHistory: async (id: number) => {
    return await request.delete({ url: `/cms/history/delete?id=` + id })
  },

  // 导出资讯浏览记录 Excel
  exportHistory: async (params) => {
    return await request.download({ url: `/cms/history/export-excel`, params })
  }
}